#include <QFtp>
#include <QCoreApplication>
#include <iostream>

int main(int argc, char *argv[])
{
    QCoreApplication app(argc, argv);
    QFtp ftp;
    ftp.connectToHost("ftp.example.com");
    ftp.login("user", "pass");
    QObject::connect(&ftp, &QFtp::listInfo, [](const QUrlInfo &info)
                     { std::cout << "File: " << info.name().toStdString()
                                 << " Size: " << info.size() << std::endl; });
    ftp.list();
    return app.exec();
}